package com.demo.conf;

import org.springframework.boot.context.embedded.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.demo.conf.filter.RequestWrapperFilter;

/**
 * 加入过滤器 封装request 
 * 以解决request.getInputStream()只能用一次(springboot 封装时已调用此方法后续获取为空)
 *
 */
@Configuration
public class RequestFilterConfiguration {
	@Bean
	public FilterRegistrationBean filterRegistration(
	      ) {
		FilterRegistrationBean registration =
	        new FilterRegistrationBean();
		registration.setFilter(new RequestWrapperFilter());
		registration.addUrlPatterns("/mobile/*");
	    return registration;
	 }
}
